#include "led_app.h"
#include "led_drv.h"

void LedTest(void)
{
    static enum {
        START = 0,
        LED_RED,
        LED_GREEN,
        LED_BLUE,
    } s_tState = {START};

    static uint8_t s_wCount;

    switch (s_tState)
    {
    case START:
        s_wCount = 3;
        s_tState = LED_RED;

        // break;
    case LED_RED:
        LedDrvSet(LED1, ENABLE);
        LedDrvSet(LED2, DISABLE);
        LedDrvSet(LED3, DISABLE);
        if (--s_wCount == 2)
        {
            s_tState = LED_GREEN;
        }
        break;
    case LED_GREEN:
        LedDrvSet(LED1, DISABLE);
        LedDrvSet(LED2, ENABLE);
        LedDrvSet(LED3, DISABLE);
        if (--s_wCount == 1)
        {
            s_tState = LED_BLUE;
        }
        break;
    case LED_BLUE:
        LedDrvSet(LED1, DISABLE);
        LedDrvSet(LED2, DISABLE);
        LedDrvSet(LED3, ENABLE);
        if (--s_wCount == 0)
        {
            RESET_FSM();
        }
        break;
    default:
        RESET_FSM();
        break;
    }
}
